home *** CD-ROM | disk | FTP | other *** search
/ Visual Basic Source Code / Visual Basic Source Code.iso / vbsource / ruthie / game3.frm (.txt) < prev    next >
Encoding:
Visual Basic Form  |  1995-05-08  |  16.5 KB  |  499 lines

  1. VERSION 2.00
  2. Begin Form Game3 
  3.    Caption         =   "RuthieWare"
  4.    ClientHeight    =   8190
  5.    ClientLeft      =   1050
  6.    ClientTop       =   1725
  7.    ClientWidth     =   11205
  8.    Height          =   8880
  9.    Left            =   990
  10.    LinkMode        =   1  'Source
  11.    LinkTopic       =   "Form1"
  12.    MinButton       =   0   'False
  13.    ScaleHeight     =   8190
  14.    ScaleWidth      =   11205
  15.    Top             =   1095
  16.    Width           =   11325
  17.    WindowState     =   1  'Minimized
  18.    Begin Timer Timer2 
  19.       Left            =   5160
  20.       Top             =   7320
  21.    End
  22.    Begin Timer Timer1 
  23.       Left            =   4680
  24.       Top             =   7320
  25.    End
  26.    Begin PictureBox Storage 
  27.       BorderStyle     =   0  'None
  28.       Height          =   495
  29.       Index           =   7
  30.       Left            =   120
  31.       Picture         =   GAME3.FRX:0000
  32.       ScaleHeight     =   495
  33.       ScaleWidth      =   495
  34.       TabIndex        =   7
  35.       Top             =   7320
  36.       Visible         =   0   'False
  37.       Width           =   495
  38.    End
  39.    Begin PictureBox Storage 
  40.       BorderStyle     =   0  'None
  41.       Height          =   495
  42.       Index           =   6
  43.       Left            =   120
  44.       Picture         =   GAME3.FRX:0302
  45.       ScaleHeight     =   495
  46.       ScaleWidth      =   495
  47.       TabIndex        =   6
  48.       Top             =   6600
  49.       Visible         =   0   'False
  50.       Width           =   495
  51.    End
  52.    Begin PictureBox Storage 
  53.       BorderStyle     =   0  'None
  54.       Height          =   495
  55.       Index           =   5
  56.       Left            =   120
  57.       Picture         =   GAME3.FRX:0604
  58.       ScaleHeight     =   495
  59.       ScaleWidth      =   495
  60.       TabIndex        =   5
  61.       Top             =   5880
  62.       Visible         =   0   'False
  63.       Width           =   495
  64.    End
  65.    Begin PictureBox Hooray 
  66.       BackColor       =   &H00FFFFFF&
  67.       BorderStyle     =   0  'None
  68.       ForeColor       =   &H00000000&
  69.       Height          =   2775
  70.       Left            =   6000
  71.       Picture         =   GAME3.FRX:0906
  72.       ScaleHeight     =   2775
  73.       ScaleWidth      =   3975
  74.       TabIndex        =   12
  75.       Top             =   5280
  76.       Visible         =   0   'False
  77.       Width           =   3975
  78.    End
  79.    Begin PictureBox Storage 
  80.       BorderStyle     =   0  'None
  81.       Height          =   495
  82.       Index           =   4
  83.       Left            =   120
  84.       Picture         =   GAME3.FRX:5BDA
  85.       ScaleHeight     =   495
  86.       ScaleWidth      =   495
  87.       TabIndex        =   4
  88.       Top             =   5160
  89.       Visible         =   0   'False
  90.       Width           =   495
  91.    End
  92.    Begin PictureBox Storage 
  93.       BorderStyle     =   0  'None
  94.       Height          =   495
  95.       Index           =   11
  96.       Left            =   840
  97.       Picture         =   GAME3.FRX:5EDC
  98.       ScaleHeight     =   495
  99.       ScaleWidth      =   495
  100.       TabIndex        =   11
  101.       Top             =   4440
  102.       Visible         =   0   'False
  103.       Width           =   495
  104.    End
  105.    Begin PictureBox Storage 
  106.       BorderStyle     =   0  'None
  107.       Height          =   495
  108.       Index           =   3
  109.       Left            =   120
  110.       Picture         =   GAME3.FRX:61DE
  111.       ScaleHeight     =   495
  112.       ScaleWidth      =   495
  113.       TabIndex        =   3
  114.       Top             =   4440
  115.       Visible         =   0   'False
  116.       Width           =   495
  117.    End
  118.    Begin PictureBox Storage 
  119.       BorderStyle     =   0  'None
  120.       Height          =   495
  121.       Index           =   10
  122.       Left            =   840
  123.       Picture         =   GAME3.FRX:64E0
  124.       ScaleHeight     =   495
  125.       ScaleWidth      =   495
  126.       TabIndex        =   10
  127.       Top             =   3720
  128.       Visible         =   0   'False
  129.       Width           =   495
  130.    End
  131.    Begin PictureBox Storage 
  132.       BorderStyle     =   0  'None
  133.       Height          =   495
  134.       Index           =   2
  135.       Left            =   120
  136.       Picture         =   GAME3.FRX:67E2
  137.       ScaleHeight     =   495
  138.       ScaleWidth      =   495
  139.       TabIndex        =   2
  140.       Top             =   3720
  141.       Visible         =   0   'False
  142.       Width           =   495
  143.    End
  144.    Begin PictureBox Storage 
  145.       BorderStyle     =   0  'None
  146.       Height          =   495
  147.       Index           =   9
  148.       Left            =   840
  149.       Picture         =   GAME3.FRX:6AE4
  150.       ScaleHeight     =   495
  151.       ScaleWidth      =   495
  152.       TabIndex        =   9
  153.       Top             =   3000
  154.       Visible         =   0   'False
  155.       Width           =   495
  156.    End
  157.    Begin PictureBox Storage 
  158.       BorderStyle     =   0  'None
  159.       Height          =   495
  160.       Index           =   1
  161.       Left            =   120
  162.       Picture         =   GAME3.FRX:6DE6
  163.       ScaleHeight     =   495
  164.       ScaleWidth      =   495
  165.       TabIndex        =   1
  166.       Top             =   3000
  167.       Visible         =   0   'False
  168.       Width           =   495
  169.    End
  170.    Begin PictureBox Storage 
  171.       BorderStyle     =   0  'None
  172.       Height          =   495
  173.       Index           =   8
  174.       Left            =   840
  175.       Picture         =   GAME3.FRX:70E8
  176.       ScaleHeight     =   495
  177.       ScaleWidth      =   495
  178.       TabIndex        =   8
  179.       Top             =   2400
  180.       Visible         =   0   'False
  181.       Width           =   495
  182.    End
  183.    Begin PictureBox Storage 
  184.       BorderStyle     =   0  'None
  185.       Height          =   495
  186.       Index           =   0
  187.       Left            =   120
  188.       Picture         =   GAME3.FRX:73EA
  189.       ScaleHeight     =   495
  190.       ScaleWidth      =   495
  191.       TabIndex        =   0
  192.       Top             =   2400
  193.       Visible         =   0   'False
  194.       Width           =   495
  195.    End
  196.    Begin PictureBox Picture1 
  197.       BorderStyle     =   0  'None
  198.       Height          =   6135
  199.       Left            =   0
  200.       ScaleHeight     =   6135
  201.       ScaleWidth      =   8535
  202.       TabIndex        =   13
  203.       Top             =   0
  204.       Width           =   8535
  205.       Begin PictureBox Actions 
  206.          BorderStyle     =   0  'None
  207.          Height          =   615
  208.          Left            =   7200
  209.          ScaleHeight     =   615
  210.          ScaleWidth      =   1695
  211.          TabIndex        =   23
  212.          Top             =   5280
  213.          Width           =   1695
  214.          Begin PictureBox GoToGame4 
  215.             BorderStyle     =   0  'None
  216.             Height          =   495
  217.             Left            =   1200
  218.             Picture         =   GAME3.FRX:76EC
  219.             ScaleHeight     =   495
  220.             ScaleWidth      =   495
  221.             TabIndex        =   24
  222.             Top             =   0
  223.             Visible         =   0   'False
  224.             Width           =   495
  225.          End
  226.          Begin PictureBox Quit 
  227.             BorderStyle     =   0  'None
  228.             Height          =   495
  229.             Left            =   600
  230.             Picture         =   GAME3.FRX:79EE
  231.             ScaleHeight     =   495
  232.             ScaleWidth      =   495
  233.             TabIndex        =   25
  234.             Top             =   0
  235.             Width           =   495
  236.          End
  237.          Begin PictureBox GoToGame2 
  238.             BorderStyle     =   0  'None
  239.             Height          =   495
  240.             Left            =   0
  241.             Picture         =   GAME3.FRX:7CF0
  242.             ScaleHeight     =   495
  243.             ScaleWidth      =   495
  244.             TabIndex        =   26
  245.             Top             =   0
  246.             Width           =   495
  247.          End
  248.       End
  249.       Begin PictureBox SadFace 
  250.          BorderStyle     =   0  'None
  251.          Height          =   2295
  252.          Left            =   3600
  253.          Picture         =   GAME3.FRX:7FF2
  254.          ScaleHeight     =   2295
  255.          ScaleWidth      =   2295
  256.          TabIndex        =   15
  257.          Top             =   2040
  258.          Visible         =   0   'False
  259.          Width           =   2295
  260.       End
  261.       Begin PictureBox SourcePicture 
  262.          DragIcon        =   GAME3.FRX:9240
  263.          Height          =   495
  264.          Left            =   360
  265.          Picture         =   GAME3.FRX:9542
  266.          ScaleHeight     =   465
  267.          ScaleWidth      =   465
  268.          TabIndex        =   14
  269.          Top             =   720
  270.          Width           =   495
  271.       End
  272.       Begin PictureBox Targets 
  273.          BorderStyle     =   0  'None
  274.          Height          =   4095
  275.          Left            =   7800
  276.          ScaleHeight     =   4095
  277.          ScaleWidth      =   495
  278.          TabIndex        =   16
  279.          Top             =   600
  280.          Width           =   495
  281.          Begin PictureBox Target 
  282.             Height          =   495
  283.             Index           =   5
  284.             Left            =   0
  285.             ScaleHeight     =   465
  286.             ScaleWidth      =   465
  287.             TabIndex        =   17
  288.             Top             =   3600
  289.             Width           =   495
  290.          End
  291.          Begin PictureBox Target 
  292.             Height          =   495
  293.             Index           =   4
  294.             Left            =   0
  295.             ScaleHeight     =   465
  296.             ScaleWidth      =   465
  297.             TabIndex        =   18
  298.             Top             =   2880
  299.             Width           =   495
  300.          End
  301.          Begin PictureBox Target 
  302.             Height          =   495
  303.             Index           =   3
  304.             Left            =   0
  305.             ScaleHeight     =   465
  306.             ScaleWidth      =   465
  307.             TabIndex        =   19
  308.             Top             =   2160
  309.             Width           =   495
  310.          End
  311.          Begin PictureBox Target 
  312.             Height          =   495
  313.             Index           =   2
  314.             Left            =   0
  315.             ScaleHeight     =   465
  316.             ScaleWidth      =   465
  317.             TabIndex        =   20
  318.             Top             =   1440
  319.             Width           =   495
  320.          End
  321.          Begin PictureBox Target 
  322.             Height          =   495
  323.             Index           =   1
  324.             Left            =   0
  325.             ScaleHeight     =   465
  326.             ScaleWidth      =   465
  327.             TabIndex        =   21
  328.             Top             =   720
  329.             Width           =   495
  330.          End
  331.          Begin PictureBox Target 
  332.             Height          =   495
  333.             Index           =   0
  334.             Left            =   0
  335.             ScaleHeight     =   465
  336.             ScaleWidth      =   465
  337.             TabIndex        =   22
  338.             Top             =   0
  339.             Width           =   495
  340.          End
  341.       End
  342.    End
  343.    Begin Menu File 
  344.       Caption         =   "&File"
  345.       Begin Menu FileAbout 
  346.          Caption         =   "&About Ruthie"
  347.       End
  348.       Begin Menu FileExit 
  349.          Caption         =   "E&xit"
  350.       End
  351.    End
  352.    Begin Menu Game 
  353.       Caption         =   "&Game"
  354.       Begin Menu GameGame1 
  355.          Caption         =   "&Game &1"
  356.       End
  357.       Begin Menu GameGame2 
  358.          Caption         =   "Game &2"
  359.       End
  360.       Begin Menu GameGame3 
  361.          Caption         =   "Game &3"
  362.          Checked         =   -1  'True
  363.       End
  364.    End
  365.    Begin Menu Instructions 
  366.       Caption         =   "&Instructions"
  367.       Begin Menu PlayGame3 
  368.          Caption         =   "Playing Game &3"
  369.       End
  370.    End
  371. Sub FileAbout_Click ()
  372.     Open2.Show MODAL
  373. End Sub
  374. Sub FileExit_Click ()
  375.     End
  376. End Sub
  377. Sub Form_Load ()
  378.     WindowState = 0
  379.     Scale                               ' Reset the scale to twips
  380.     Height = 6600                       ' Define standard size (note 3/4 proportion)
  381.     Width = 8800
  382.     Left = (Screen.Width - Width) / 2   ' Center form horizontally.
  383.     Top = (Screen.Height - Height) / 2  ' Center form vertically.
  384.     InitGame3       'Upon loading the form, initialize the pictures
  385. End Sub
  386. Sub Form_Resize ()
  387.     Scale                               ' Reset scale to twips
  388.     If Game3.Height < 6600 Then
  389.         MsgBox "Sorry, you can't make the game any shorter...", 48, "RuthieWare"
  390.         Game3.Height = 6600
  391.     End If
  392.     If Game3.Width < 8800 Then
  393.         MsgBox "Whoa, Dude! You can't make the game any narrower...", 48, "RuthieWare"
  394.         Game3.Width = 8800
  395.     End If
  396.     If Game3.Height > 100 Then InitGame3
  397. End Sub
  398. Sub GameGame1_Click ()
  399.     Game3.Hide
  400.     Ruthie.Show
  401. End Sub
  402. Sub GameGame2_Click ()
  403.     Game3.Hide
  404.     Game2.Show
  405. End Sub
  406. Sub GameGame3_Click ()
  407.     MsgBox "We hate to break the bad news, but... You're already playing Game 3", 0, HEADER
  408. End Sub
  409. Sub GoToGame2_Click ()
  410.     Game3.Hide
  411.     Game2.Show
  412. End Sub
  413. Sub GoToGame4_Click ()
  414.     MsgBox "Chu got a problem, main... There is no game 4 yet.", 0, HEADER
  415. End Sub
  416. Sub InitGame3 ()
  417.     '***    What we need to do is initialize an array with 6 elements. We want to initialize the
  418.     '       array in a random fashion, but we don't want the elements duplicated. That is, we want
  419.     '       to "shuffle" the elements.
  420.     Static TempArray(5)
  421.     Randomize                       ' This "seeds" the random number generator
  422.                                     ' Now we'll assign 0 to 5 to an array
  423.     For Counter1 = 0 To 5
  424.         TempArray(Counter1) = Counter1
  425.     Next Counter1
  426.     For Counter2 = 1 To 30          ' Now we'll swap 30 random pairs in that temporary array
  427.         j = Int(Rnd * 6)            ' produces a value from 0-5
  428.         k = Int(Rnd * 6)            ' sometimes these'll be the same value
  429.         temp = TempArray(j)
  430.         TempArray(j) = TempArray(k)
  431.         TempArray(k) = temp
  432.     Next Counter2
  433.     For Counter3 = 0 To 5           ' Now we'll use the shuffled array to load the target picture array
  434.         Target(Counter3).Picture = Storage((TempArray(Counter3) * 2)).Picture
  435.     Next Counter3
  436.     Temp2 = (Int(Rnd * 6) * 2)      ' Now we'll pick a random picture for the source picture...
  437.     SourcePicture.Picture = Storage(Temp2).Picture
  438.     SourcePicture.DragIcon = Storage(Temp2 + 1).Picture  ' and it's pair for the DragIcon.
  439.                                     ' Some other Form_Load and Form_Resize events
  440.     Game3.Scale (0, 0)-(100, 75)    ' Define the internal scale (note the 3/4 proportion)
  441.     Picture1.Top = 0
  442.     Picture1.Left = 0
  443.     Picture1.Height = Game3.ScaleHeight
  444.     Picture1.Width = Game3.ScaleWidth
  445.     Picture1.Scale (0, 0)-(100, 75)
  446.     SourcePicture.Top = 8                     ' No need to define height or width--it's a fixed-size icon
  447.     SourcePicture.Left = 10
  448.     Targets.Top = 8
  449.     Targets.Left = 90 - Targets.Width         ' Thus flush right on scale 90
  450.     Actions.Top = 70 - Actions.Height         ' Thus flush with scale 70
  451.     Actions.Left = 90 - (Actions.Width * .66) ' Adjust visible width to hide GoToGame4
  452.     SadFace.Top = (Picture1.ScaleHeight - SadFace.Height) / 2
  453.     SadFace.Left = (Picture1.ScaleWidth - SadFace.Width) / 2
  454.     Hooray.Height = Game3.ScaleHeight * .6
  455.     Hooray.Width = Game3.ScaleHeight * .75
  456.     Hooray.Top = (Game3.ScaleHeight - Hooray.Height) / 2
  457.     Hooray.Left = (Game3.ScaleWidth - Hooray.Width) / 2
  458.     Picture1.Refresh                          ' Force refresh of Picture1
  459. End Sub
  460. Sub Picture1_Click ()
  461.     SadFace.Visible = True
  462.     Timer1.Interval = HOWLONG
  463. End Sub
  464. Sub Picture1_DragDrop (Source As Control, X As Single, Y As Single)
  465.     SadFace.Visible = -1
  466.     Timer1.Interval = 2500
  467. End Sub
  468. Sub PlayGame3_Click ()
  469.     InstGame3.Show MODAL
  470. End Sub
  471. Sub Quit_Click ()
  472.     End
  473. End Sub
  474. Sub SourcePicture_MouseDown (Button As Integer, Shift As Integer, X As Single, Y As Single)
  475.     StartX = X
  476.     StartY = Y
  477.     SourcePicture.Drag 1            ' Initiate drag movement
  478. End Sub
  479. Sub SourcePicture_MouseUp (Button As Integer, Shift As Integer, X As Single, Y As Single)
  480.     SourcePicture.Drag 2
  481. End Sub
  482. Sub Target_DragDrop (Index As Integer, Source As Control, X As Single, Y As Single)
  483.     If SourcePicture.Picture = Target(Index).Picture Then
  484.         Hooray.Visible = True
  485.         InitGame3
  486.         Timer1.Interval = HOWLONG  ' Interval is defined in the (general declarations) section
  487.     Else
  488.         SadFace.Visible = True
  489.         Timer1.Interval = HOWLONG
  490.     End If
  491. End Sub
  492. Sub Timer1_Timer ()
  493.     Hooray.Visible = False          ' Turn off the Hooray! picture
  494.     SadFace.Visible = False         ' Depending on which picture was displayed, turn off SadFace...
  495. End Sub
  496. Sub Timer2_Timer ()
  497.     SadFace.Visible = False
  498. End Sub
  499.